package demo.Input;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

import static demo.until.FileUtil.FILE_PATH;

public class CharStreamDemo2 {
    public static void main(String[] args) throws IOException {
        FileReader fr = new FileReader(FILE_PATH+"a.txt");
        FileWriter fw = new FileWriter(FILE_PATH+"b.txt");

        char[] chars = new char[2];

        int len;

        while((len = fr.read(chars))!=-1){
            System.out.println(new String(chars,0,len));
            fw.write(chars);
        }
    }
}
